<template>
  <div class="article-list">
    <template v-if="articleList.length > 0">
      <div class="article-item" v-for="article in articleList" :key="article.articleId">
        <h3 class="title"><a :title="article.title"
                             :href="'article/detail?articleId='+article.articleId">{{ article.title }}</a></h3>
        <p class="profile" :title="article.profile">{{ article.profile }}</p>
        <div class="article-info">
          <div class="author">
            作者：{{ article.author }}
          </div>
          <div class="apply-time">
            发表时间：{{ article.applyTime }}
          </div>
        </div>
        <div class="article-count">
          <p>阅读量：{{ article.readCount }}</p>
        </div>
        <div class="category">
          <el-tag style="margin-right: 10px;cursor: pointer" size="mini" type="success" offect="dark"
                  v-for="c in article.categoryList" :key="c.categoryId">{{ c.categoryName }}
          </el-tag>
        </div>
      </div>
      <p v-if="noScroll" style="text-align: center">我是有底线的~！</p>
    </template>
    <template v-else>
      <div style="text-align: center">暂无文章~!</div>
    </template>
  </div>
</template>

<script>
export default {
  name: 'ArticlePage',
  props: {
    articleList: {
      type: Array
    },
    noScroll: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {}
  }
}
</script>

<style scoped lang="scss">
.article-list {
  width: 780px;

  .article-item {
    width: 90%;
    margin: 20px auto 60px;

    .title {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-bottom: 10px;

      a {
        text-decoration: none;
        color: black;
      }

      a:hover {
        color: cornflowerblue;
      }
    }

    .profile {
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      margin-bottom: 10px;
      padding-left: 20px;
    }

    .article-info {
      display: flex;
      justify-content: space-between;
      margin-bottom: 10px;
    }

    .article-count {
      margin-bottom: 10px;
    }
  }
}
</style>
